<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title>
  <style>
    /* 400px 的屏幕  */

    @media screen and (width: 400px) {
      body {
        background-color: red;
      }

    }

    /* 600px 的屏幕  */

    @media screen and (width: 600px) {
      body {
        background-color: blue;
      }

    }

    /* 800px 的屏幕  */

    @media screen and (width: 800px) {
      body {
        background-color: green;
      }

    }
  </style>
</head> <body> </body> </html>